﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="废料到货管理.aspx.cs" Inherits="syc.Store.废料到货管理" %>

<html>
<head runat="server">
    <title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" >
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
SelectCommand="select 0 as ID,'全部' as 废料名称 union select ID, 废料名称 FROM 废料"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="select 0 as ID,'全部' as 名称 union SELECT [ID], [名称] FROM [生产单位]"></asp:SqlDataSource>

<div id="wintop" class="wintop">废料管理</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel" GroupingText="废料入库记录查询">

 <div style="font-size:6px;height:6px;line-height:6px;"></div>
  年度：<asp:DropDownList ID="NianDu" 
        runat="server" Width="80px"  
       > 
       <asp:ListItem Value="0">全部</asp:ListItem>
       <asp:ListItem Value="2010">2010</asp:ListItem>
       <asp:ListItem Value="2011">2011</asp:ListItem>
       <asp:ListItem Value="2012">2012</asp:ListItem>
       <asp:ListItem Value="2013">2013</asp:ListItem>       
       <asp:ListItem Value="2014">2014</asp:ListItem>
       <asp:ListItem Value="2015">2015</asp:ListItem>
       <asp:ListItem Value="2016">2016</asp:ListItem>
       <asp:ListItem Value="2017">2017</asp:ListItem>
       <asp:ListItem Value="2018">2018</asp:ListItem>
       <asp:ListItem Value="2019">2019</asp:ListItem>       
       <asp:ListItem Value="2020">2020</asp:ListItem>
       </asp:DropDownList>      
       <span style="margin-left:8px;"></span>   月份：<asp:DropDownList ID="YueFen" 
        runat="server" Width="80px"  
       > 
       <asp:ListItem Value="0">全部</asp:ListItem>
       <asp:ListItem Value="1">1</asp:ListItem>
       <asp:ListItem Value="2">2</asp:ListItem>
       <asp:ListItem Value="3">3</asp:ListItem>
       <asp:ListItem Value="4">4</asp:ListItem>
       <asp:ListItem Value="5">5</asp:ListItem>
       <asp:ListItem Value="6">6</asp:ListItem>
       <asp:ListItem Value="7">7</asp:ListItem>
       <asp:ListItem Value="8">8</asp:ListItem>
       <asp:ListItem Value="9">9</asp:ListItem>
       <asp:ListItem Value="10">10</asp:ListItem>
       <asp:ListItem Value="11">11</asp:ListItem>
       <asp:ListItem Value="12">12</asp:ListItem>
       </asp:DropDownList>
      <span style="margin-left:8px;"></span> 入库单位：<asp:DropDownList ID="ShouHuoDanWei" 
        runat="server" Width="80px" DataSourceID="SqlDataSource3" DataTextField="名称" 
        DataValueField="ID"> </asp:DropDownList>
        <span style="margin-left:8px;"></span> 
        废 料：<asp:DropDownList ID="LeiBie" runat="server" 
        DataSourceID="SqlDataSource2" Width="80px"
        DataTextField="废料名称" DataValueField="ID" style="height: 22px">
    </asp:DropDownList>      
<span style="margin-left:5px;">
    <asp:Button ID="Button_Query" runat="server" CssClass="mbutton" 
        onclick="Button_Query_Click" Text="查 询" UseSubmitBehavior="false" />
    <span>
    <asp:Button ID="Button_Reset" runat="server" CssClass="mbutton" 
        onclick="Button_Reset_Click" Text="清空条件" UseSubmitBehavior="false" />
    </span></span>

<span style="margin-left:5px;"></span></asp:Panel>


 <asp:Panel ID="Panel4" runat="server" CssClass="panel2"  Visible="false">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
    </asp:Panel>
<div class="gridframe">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
            <tr>
	            <td class="grid-title"><div style="float:left;margin-top:3px;">废料入出记录</div><div style="float:right;">
                    <asp:DropDownList ID="PageSizeOption" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="PageSizeOption_SelectedIndexChanged">
                    <asp:ListItem Value="10">10 项/页</asp:ListItem>
                    <asp:ListItem Value="20" Selected="True">20 项/页</asp:ListItem>
                    <asp:ListItem Value="30">30 项/页</asp:ListItem>
                    <asp:ListItem Value="50">50 项/页</asp:ListItem>
                    <asp:ListItem Value="100">100 项/页</asp:ListItem>
                    </asp:DropDownList></div>
	            </td>
	        </tr>
	        <tr>
	            <td class="grid-back">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CssClass="grid"
                        DataSourceID="SqlDataSource1"
                        PageSize="20"
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                        UseAccessibleHeader="False" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged" 
                       >
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>
                           <asp:TemplateField HeaderText="">
                                    <ItemTemplate>
                                        <asp:Button ID="Button_xz" runat="server" CommandName="Select" Text="选择" CssClass="hide"/>
                                        <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />                                    
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                                </asp:TemplateField>                                                                     
                              
                            <asp:TemplateField HeaderText="年度" >
                                <ItemTemplate>                                 
                                 <asp:Label ID="Label_nd" runat="server" Text='<%# Eval("年度") %>' ></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>  
                            
                            <asp:TemplateField HeaderText="月份" >
                                <ItemTemplate>                                 
                                 <asp:Label ID="Label_yf" runat="server" Text='<%# Eval("月份") %>' ></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                            </asp:TemplateField>                            
                            
                            <asp:TemplateField HeaderText="入库单位">
                                <ItemTemplate>
                                    <asp:Label ID="Label_gy" runat="server" Text='<%# Eval("供货或使用") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" Width="80px"  HorizontalAlign="Center" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="废料名称" SortExpression="废料名称">
                                <ItemTemplate>
                                    <asp:Label ID="Label_pm" runat="server" Text='<%# Eval("废料名称") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                            </asp:TemplateField>
                            
                             <asp:TemplateField HeaderText="单位" SortExpression="单位">
                                <ItemTemplate>
                                    <asp:Label ID="Label_gg" runat="server" Text='吨'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="50px" />
                            </asp:TemplateField>                             
                                        
                            <asp:TemplateField HeaderText="磅量">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zs" runat="server" Text='<%# Eval("数量") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                            </asp:TemplateField> 
                            <asp:TemplateField HeaderText="计划单价(元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label_jhdj" runat="server" Text='<%# Eval("计划单价") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                            </asp:TemplateField>  
                            
                            <asp:TemplateField HeaderText="实际单价(元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label_sjdj" runat="server" Text='<%# Eval("实际单价") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                            </asp:TemplateField> 
                              
                            <asp:TemplateField HeaderText="计划金额(元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label_jhje" runat="server" Text='<%# Eval("计划金额","{0:0.00}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                            </asp:TemplateField>    
                            
                             <asp:TemplateField HeaderText="实际金额(元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label_sjje" runat="server" Text='<%# Eval("实际金额","{0:0.00}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                            </asp:TemplateField>                         
                                                                                
                                           
                            
                        </Columns>
                        <SelectedRowStyle CssClass="grid-row-selected" />
                      </asp:GridView>
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                 
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
        

    </div>
</div>
</form>
<script>
 
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = function() { this.firstChild.firstChild.click(); };
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }

    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT") {
            if (e.keyCode == 13) e.keyCode = 9;
        }
    }
    var rows = document.getElementById("GridView1").rows;
    var sum1 = 0;
    var sum2 = 0;
    var sum3 = 0;
    var sum4 = 0;
    for (i = 1; i < rows.length; i++) {
        sum1 += Number(rows[i].cells[6].innerText);
        sum2 += Number(rows[i].cells[9].innerText);
        sum3 += Number(rows[i].cells[10].innerText);
    }
    var total = document.getElementById("Label_Total");
    total.innerHTML += " </br>本页小计（磅量合计：" + fixFloatZ(sum1, 3) + " 吨  计划金额合计：" + fixFloatZ(sum2, 2) + " 元 实际金额合计：" + fixFloatZ(sum3, 2) + " 元）";
   
    
</script>
</body>
</html>
